package edu.yang.dbutils.result;

import edu.yang.dbutils.RowProcessor;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author yang
 * @date 2024-05-12
 */
public class BeanListHandler<T> extends AbstractListHandler<T>{
    private final Class<T> beanClass;

    public BeanListHandler(Class<T> beanClass) {
        this.beanClass = beanClass;
    }

    @Override
    public T handleRow(ResultSet rs) throws SQLException {
        return RowProcessor.toBean(rs, beanClass);
    }
}
